/**
 * 分页查询方法
 * @param url
 * @param pageNo
 * @param pageSize
 */
function submit(url, pageNo, pageSize) {
    if (pageNo === undefined) {
        pageNo = initPageNo;
    }
    if (pageSize === undefined) {
        pageSize = initPageSize;
    }

    layui.use(['table', 'laypage', 'form'], function () {
        let table = layui.table;
        let laypage = layui.laypage;
        let loading = layer.msg('正在查询...', {icon: 16, shade: 0.3, time:0});
        //第一个实例
        table.render({
            elem: '#searchTable',
            url: url,
            page: false,
            toolbar: '#tableToolbar',
            method: 'POST',
            height: 'full-250',
            headers: {"token": getCookie("token")},
            contentType: "application/json",
            where: {
                pageNo: pageNo,
                pageSize: pageSize
            },
            cols: [[
                {type:'numbers',align: 'center'}
                , {field: 'channelNo', title: '产品', width: '200', align: 'center'}
                , {field: 'encryptKey', title: '秘钥', width: '300', align: 'center'}
                , {
                    field: 'createTime', title: '创建时间', width: '200', align: 'center', templet: function (d) {
                        return toDateString(d.createTime);
                    }
                }
            ]]
            ,
            parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.pageInfo.totalCount, //解析数据长度
                    "pageNo": res.data.pageInfo.pageNo, //解析数据长度
                    "pageSize": res.data.pageInfo.pageSize, //解析数据长度
                    "data": res.data.pageInfo.list //解析数据列表
                };
            }
            ,
            done: function (res) {
                layer.close(loading);
                //校验登陆状态
                checkLogin(res);
                //自定义分页
                laypage.render({
                    elem: 'tablePage'
                    , curr: res.pageNo
                    , count: res.count
                    , limit: res.pageSize
                    , layout: ['page', 'limit', 'count', 'skip']
                    , theme: '#1b2b34'
                    , jump: function (obj, first) {
                        if (!first) {
                            submit(url, obj.curr, obj.limit);
                        }
                    }
                });
            }
        });
    });
}
